package com.zzw.basic.io;

import java.io.IOException;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;

public class FileVistorTest {

	public static void main(String[] args) throws IOException {
		Files.walkFileTree(Paths.get("g:","publish","codes","15"),new SimpleFileVisitor<Path>(){
			@Override
			public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
				System.out.println("���ڷ���" + file + "�ļ�");
				if(file.endsWith("FileVistorTest.java")){
					System.out.println("---���ҵ�Ŀ���ļ�---");
					return FileVisitResult.TERMINATE;
				}
				return FileVisitResult.TERMINATE;
			}
			
			@Override
			public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
				System.out.println("���ڷ���:" + dir + "·��");
				return FileVisitResult.CONTINUE;
			}
		});
	}
}